Programmable controllers are typically connected to industrial equipment, such as assembly lines and machine tools, to sequentially operate the equipment in accordance with a stored program. In programmable controllers such as those disclosed in the above cited patents, for example, the control program is stored in a memory and includes instructions which are read out in rapid sequence and interpreted to examine the condition of selected sensing devices on the controlled equipment, or to energize or deenergize selected operating devices on the controlled equipment contingent upon the status of one or more of the examined sensing devices.
The program execution processor for these controllers is designed to rapidly interpret programmable controller type instructions which in medium to large sized controllers include not only instructions that manipulated single-bit input and output data, but also arithmetic instructions, file handling instructions, timers and counters, sequencers and other, more complex instructions. Such instructions have become quite standardized in the industry and they may be directly associated with elements of a ladder diagram which is easily understood by control engineers. Program panels such as those disclosed in U.S. Pat. Nos. 3,798,612 and 3,813,649 and in U.S. Pat. No. 4,070,702 have been developed to assist the user in developing and editing ladder diagram type control programs comprised of such programmable controller instructions.
While ladder diagram control programs are particularly easy to create and edit for relatively small to medium scale control tasks, they become cumbersome and inefficient to use in large control tasks. Large ladder diagram control programs are difficult to understand, difficult to troubleshoot, and require a long time to execute.
U.S. Pat. No. 4,742,443 addresses this problem. The controller described therein includes a program execution processor which stores a plurality of separate ladder control programs that are logically related to each other by a stored structure chart program, and the processor is operable to interpret the stored structure chart program which directs which ones of the stored ladder programs are to be repeatedly interpreted by the processor at any point in time. It has been discovered that large control tasks can usually be broken down into separate control steps which are executed in a sequential order as the controlled machine or process advances through its states. Each control step is defined by a separately interpretable ladder program which is easy to understand and which may be executed at a very high scan rate. The sequence in which the separate control steps are interpreted is defined by the structure chart program which is a general expression of how the controlled machine or process is to operate. The user may thus define the general manner in which the machine or process is to operate using structure chart constructs, and then define the detailed operation of the machine or process in separate, easily managed ladder programs.
Heretofore the ladder diagrams were written in a relatively high level language for processing by an interpreter in the controller. The interpreter program in the program execution processor analyzed each ladder rung or a subpart of a rung and executed a machine language routine corresponding to the function defined by that part of the ladder. Because the ladder program was stored as a high level language, it could easily be recalled for editing on a terminal connected to the programmable controller. However, interpreters are relatively slow. As programmable controllers became more complex handling many more tasks and operating larger pieces of equipment, the ability of such interpreters to control the equipment and process the tasks in a timely fashion became a matter of concern.
One well known way of speeding up program execution is to compile the higher level language program into machine language instructions which can be executed directly by the processor. Compilers could be written to take the ladder diagram source code and generate a machine language object code version of the control program for the processor in the programmable controller to execute. A drawback to compiled programs is that the object code is not easily edited when changes are to be made to the controlled process. This drawback is even more significant in respect of programmable controllers as the equipment operator is not a skilled computer programmer. It is therefore advantageous to edit a source code version of the ladder control program. However, maintaining a copy of the source code in the programmable controller requires significant additional memory. Although the source code may be archived on a floppy disk or magnetic tape, such media are not always practical for storage and use in an manufacturing environment where dirt and magnetic fields may damage them.
An alternative approach is to decompile the stored object code to produce a version of the control program in a higher level language. Although some rungs of the ladder control program may be decompiled, not every compiled step may be reverse processed to produce the original rung of the ladder diagram. A complex section of a rung, such as an arithmetic computation, compiles into a number of machine language instructions. It is often very difficult, if not impossible, to examine a series of machine language instructions and resurrect the original section of the rung.
Even if the object code could be decompiled properly, editing previously had to be carried out when the particular program was not being executed by the programmable controller. With previous editing techniques, such as those shown in U.S. Pat. No. 3,813,649, the editing had to be performed either when the equipment being operated by the programmable controller was shut down or when another one of the ladder control programs was being interpreted. This not only placed severe restrictions on when the program could be edited, but also had adverse affects on the equipment operation.